package com.cloud.xtools.api.config;

import com.cloud.xtools.api.interceptor.OpenFeignInterceptor;
import feign.Logger;
import feign.RequestInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenFeignConfig {

    @Value("${openfeign.logging.level}")
    private Logger.Level openFeignLogLevel;

    // 日志
    @Bean
    Logger.Level feignLoggerLevel() {

        return openFeignLogLevel;
    }

    // 拦截器
    @Bean
    public RequestInterceptor openFeignInterceptor() {
        return new OpenFeignInterceptor();
    }
}
